package com.coderbean.demo.leaveapply.listener;

import java.util.List;
import java.util.stream.Collectors;

import com.coderbean.demo.entity.UserModel;
import com.coderbean.demo.service.UserRepository;
import com.coderbean.demo.util.SpringContextUtils;
import org.flowable.engine.delegate.DelegateExecution;
import org.flowable.engine.delegate.ExecutionListener;

public class HuiqianListener implements ExecutionListener{

	/**
	 * 
	 */
	private static final long serialVersionUID = -599516563956452841L;

	@Override
	public void notify(DelegateExecution execution) {
         // 设置审批人员
		UserRepository userRepository = SpringContextUtils.getBean(UserRepository.class);
		List<UserModel> userModels = userRepository.findAll();
		List<Integer> ids = userModels.stream().map(e -> e.getId()).collect(Collectors.toList());
		execution.setVariable("assigneeList", ids);
	}

}
